//@author A0096566M
/*

	Unit tests for Record class

*/

#include "../records.h"

//Basic Functions Test.

TEST(recordsTest, testInitialize)
{
	Records rec;
	FileInterface* fInt = new FileInterface();
	rec.initialize(fInt);

	EXPECT_EQ(rec.getFileInterface(), fInt);
}

TEST(recordsTest, testAdd)
{
	Records rec;
	Task a;
	EXPECT_EQ(rec.getRecordSize(),0);
	rec.addData(a);
	EXPECT_EQ(rec.getRecordSize(),1);
}

TEST(recordsTest, testDelete)
{
	Records rec;
	Task a;
	EXPECT_EQ(rec.getRecordSize(),0);
	rec.addData(a);
	EXPECT_EQ(rec.getRecordSize(),1);
	rec.delData(0);
	EXPECT_EQ(rec.getRecordSize(),0);
}

TEST(recordsTest, testDeleteAll)
{
	Records rec;
	Task a;
	rec.addData(a);
	rec.addData(a);
	rec.addData(a);
	rec.addData(a);
	rec.addData(a);
	EXPECT_EQ(rec.getRecordSize(),5);
	rec.delDataAll();
	EXPECT_EQ(rec.getRecordSize(),0);
}

TEST(recordsTest, emptyCheck)
{
	Records rec;
	Task a;
	
	EXPECT_EQ(rec.empty(),true);
	rec.addData(a);
	EXPECT_EQ(rec.empty(),false);
}

//More Tests for filter, sort, get/set below.